import request from '@/router/axios';
import {baseUrl} from '@/config/env';

export const list = (data) => {
    return request({
            url: baseUrl + '/generator/sysDataTableConfig/page',
            method: 'get',
            data: data
        }
    )
}
/**
 * 添加数据
 * @param data
 * @returns {*}
 */
export const add = (data) => {
    return request({
            url: baseUrl + '/generator/sysDataTableConfig/add',
            method: 'post',
            data: data
        }
    )
}
/**
 * 根据id 修改数据
 * @param id
 * @param data
 * @param index
 * @returns {*}
 */
export const updateById = (id, data, index) => {
    return request({
            url: baseUrl + '/generator/sysDataTableConfig/updateById',
            method: 'put',
            data: data
        }
    )
}
/**
 * 根据id 删除数据
 * @param id
 * @returns {*}
 */
export const deleteById = (id) => {
    return request({
            url: baseUrl + '/generator/sysDataTableConfig/deleteById/' + id,
            method: 'delete',
        }
    )
}
/**
 * 下载导入模板
 * @returns {*}
 */
export const downloadTemplate = () => {
    return request({
            url: baseUrl + '/generator/sysDataTableConfig/downloadTemplate',
            method: 'get',
            responseType: 'blob'
        }
    )
}
/**
 * 导出excel
 * @param data
 * @returns {*}
 */
export const exportExcel = (data) => {
    return request({
            url: baseUrl + '/generator/sysDataTableConfig/exportFile',
            method: 'get',
            responseType: 'blob',
            data: data
        }
    )
}
/**
 * 导入excel
 * @param data
 * @returns {*}
 */
export const importExcel = (data) => {
    return request({
            url: baseUrl + '/generator/sysDataTableConfig/importExcel',
            method: 'post',
            data: data
        }
    )
}